package com.dgshanger.sanhxiaofeisc.mvp.presenter;

import com.dgshanger.sanhxiaofeisc.entity.MyTeamEntity;
import com.dgshanger.sanhxiaofeisc.mvp.contract.MyTeamContract;
import com.dgshanger.sanhxiaofeisc.mvp.model.MyTeamModel;
import com.xx.baseuilibrary.mvp.BaseRxMvpPresenter;
import com.xx.baseutilslibrary.network.rx.RxHttpObserver;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * MyTeamPresenter
 * 沉迷学习不能自拔
 * Describe：
 * Created by 雷小星🍀 on 2018/5/8 14:38.
 */

public class MyTeamPresenter extends BaseRxMvpPresenter<MyTeamContract.Model, MyTeamContract.View> implements MyTeamContract.Presenter {
    @NotNull
    @Override
    protected MyTeamContract.Model createModel() {
        return new MyTeamModel();
    }

    @Override
    public void loadDetail() {
        getModel().loadDetail(new RxHttpObserver<MyTeamEntity>() {
            @Override
            public void onCompleted(@Nullable String msg, @Nullable MyTeamEntity entity) {
                if (getView() == null || entity == null) {
                    return;
                }
                getView().setUserDetail(entity.getUser_detail());
            }

            @Override
            public void onError(@Nullable String error) {

            }

            @Override
            public void onLoadingStart() {
                attachObserver(this);
            }

            @Override
            public void onLoadingFinish() {

            }
        });
    }
}
